<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@include file="header.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Edit Fitting</title>
 
</head>
<body>
<script>
	function getObj(obj){
		return document.getElementById(obj)
	};
	$(document).ready(function(){
	    $("table tbody tr:even").addClass("tdbgcolor1"); 
	    $("table tbody tr:odd").addClass("tdbgcolor2"); 
	});
	function checkAndSubmit(){
		frames['editor'].GetCon();
		var form = document.getElementById("updateFittingForm");
		form.submit();
	}
	function getPeijLeixing() {
        $.ajax({
        	type: "POST",
         	url: "fetchFittingTypeByBaseId.action",
         	data: "fittingtypebaseIdQ="+$.trim($("#basetypeId")[0].value),
         	success: function(msg){
	        	var data = eval(msg);
	           	var selectObj =  document.getElementById("fittingTypeId");
	
	            var length = selectObj.length;
	       		for(var i=length-1;i>=0;i--){
	          		selectObj.remove(i);
	          	}            
	            for(var i = 0; i < data.length;i++) {
	                   selectObj.options.add(new Option(data[i].name,data[i].id));
	            }
         	}   
      	});
	}
	function showUploadWindow(id){
		var InfoW=620;
		var InfoH=400;
		var InfoUrl="edit/insert_images.action?uploadFolder=<%=com.windfone.common.Constant.UPLOAD_FITTING %>";
		var str=window.showModalDialog(InfoUrl,"","dialogWidth="+InfoW+"px;dialogHeight="+InfoH+"px;center=yes;help=no;resizable=no;status=no;scroll=no");
		if ( str != undefined){
			$("#"+id).val(str);
			$("#"+id+"1").attr("src","<%=contextPath%>/"+str);
		}
	}		
</script>
<div align="center">编辑手机配件</div>
<form method="post" action="updateFitting.action" id="updateFittingForm">
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF" align="center">
<tr>
		<td width="110">配件基本类型:</td>
		<td>
		<s:select list="fittingtypebases"  listValue="name" listKey="id"  name="basetypeId"  id="basetypeId"  onchange="getPeijLeixing()"  value="fitting.fittingTypeBaseId"></s:select>
		</td>
	</tr>
	<tr>
		<td >配件类型:</td>
		<td >
		<s:select list="fittingTypeList"  listValue="name" listKey="id"  name="fittingTypeId"  id="fittingTypeId"    value="fitting.fittingTypeId"></s:select>
		</td>
	</tr>
	<tr>
		<td>类型:</td>
		<td><input size="50" type="text" name="typeName" id="typeName"  value="<s:property value='fitting.typeName'/>" /></td>
	</tr>
	<tr>
		<td>主要参数:</td>
		<td><input size="50"  type="text" name="parameter" id="parameter"   value="<s:property value='fitting.parameter'/>" /></td>
	</tr>
	<tr>
		<td>相关服务:</td>
		<td><input size="50"   type="text" name="service" id="service"  value="<s:property value='fitting.service'/>"/></td>
	</tr>
	<tr>
		<td>备注:</td>
		<td><input  size="50"   type="text" name="memo" id="memo" value="<s:property value='fitting.memo'/>"/></td>
	</tr>
	<tr>
		<td>标准配置:</td>
		<td><input type="text"   size="50"  name="standar" id="standar"  value="<s:property value='fitting.standar'/>"/></td>
	</tr>	
	<tr>
		<td>其他性能:</td>
		<td><input type="text" name="otherProperties"  size="50"   id="otherProperties"   value="<s:property value='fitting.otherProperties'/>"/></td>
	</tr>
	<tr>
		<td>上市时间:</td>
		<td><input type="text" name="marketTime" id="marketTime"   size="50"   value="<s:property value='fitting.marketTime'/>"/></td>
	</tr>
	<tr>
		<td>价格:</td>
		<td><input type="text" name="priceStr" id="priceStr"   value="<s:property value='fitting.price'/>" /></td>
	</tr>
	<tr>
		<td>内容:</td>
		<td>
		<textarea id='content' name='content' style='display:none'><s:property value='fitting.content'/></textarea>
		<iframe name='editor' src='edit/edit.action?V=content&T=2&A=1&uploadFolder=<%=com.windfone.common.Constant.UPLOAD_FITTING %>' frameBorder='0' marginHeight='0' marginWidth='0' scrolling='no' style='height:250px;width:640px'></iframe>
		</td>
	</tr>
	<tr>
		<td >配件小图:</td>
	  	<td  nowrap="nowrap">
				<img src="<%=contextPath%>/<s:property value='fitting.imagepath'/>"  id="imagepath1" name="imagepath1" border="0"/> &nbsp; <input type="button" value="照片"  onClick="showUploadWindow('imagepath')"/>
		</td>
	</tr>	
	<tr>
		<td >配件大图:</td>
	  	<td  nowrap="nowrap">
				<img src="<%=contextPath%>/<s:property value='fitting.bigimagepath'/>"  id="bigimagepath1" name="bigimagepath1" border="0"/> &nbsp; <input type="button" value="照片"  onClick="showUploadWindow('bigimagepath')"/>
		</td>
	</tr>	
	<tr>

		<td colspan="2">
		<input type="hidden" name="imagepath" id="imagepath" value="<s:property value='fitting.imagepath'/>"/>
		<input type="hidden" name="bigimagepath" id="bigimagepath" value="<s:property value='fitting.bigimagepath'/>"/>
		<input type="button" value="Save"	onclick="checkAndSubmit()" />&nbsp; 
		<input type="button" value="reset" />&nbsp; 
		<input type="hidden"  value="<s:property value='fitting.id'/>" name="fittingId"   id="fittingId" />&nbsp; 
		<input type="button" value="返回"	onclick="javascript:window.location.href='fittingList.action';" />
		</td>
</table>
</form>
</body>
</html>
